/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.tmro.mobile.txtapark;

import javax.microedition.rms.RecordComparator;

/**
 *
 * @author tmro
 */
public class MyRecordComparator implements RecordComparator {

    public int compare(byte[] rec1, byte[] rec2) {
        String string1 = new String(rec1);
        String string2 = new String(rec2);

        int comparison = string1.compareTo(string2);
        if (comparison == 0) {
            return RecordComparator.EQUIVALENT;
        } else if (comparison < 0) {
            // if string 2 > string 1 then string 1 follows string 2 because i want to have desc order
            return RecordComparator.FOLLOWS;
        } else {
            return RecordComparator.PRECEDES;
        }
    }
}
